package com.qf.handlers;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.List;

@Component
public class WmnewsPubHandler {

    @XxlJob("demoJobHandler")
    public void demoJobHandler() throws Exception {
        System.out.println("任务执行-时间:" + LocalDateTime.now());
        int shardIndex = XxlJobHelper.getShardIndex();
        int shardTotal = XxlJobHelper.getShardTotal();
        System.out.println("shardTotal:" + shardTotal + "==" + "shardIndex:" + shardIndex);
        System.out.println("-------------------");
    }
}

//interface WmnewsMapper{
//    @Select("SELECT * FROM wm_news WHERE MOD(id,#{shardTotal})=#{shardIndex}")
//    List<Wmnews> findAll(int shardTotal,int shardIndex);
//}
